import random
dit={}
f=open("sql_class.txt",mode="w")
content=""
i=1
class_arr=[]
while i<=150:
    course_id=random.randint(8305001,8305100)
    staff_id=random.randint(1001,1030)
    days=['星期一','星期二', '星期三', '星期四', '星期五']
    day=random.choice(days)
    start_time=random.randint(1,5)*2-1
    end_time=start_time+1
    key=f"{course_id}{staff_id}"
    class_arr.append([course_id,staff_id,f'{day}{start_time}-{end_time}'])
    if not key in dit.keys():
        content+=f"('2023春季','0{course_id}','{staff_id}','{day}{start_time}-{end_time}'),\n"
        dit[key]=(staff_id)
        i+=1

f.write(content)
f.close()

dit={}
i=1
f=open("sql_course_selestion.txt",mode="w")
content=""
while i<=1000:
    student_id=random.randint(1101,1150)
    class_choice=random.choice(class_arr)
    course_id=class_choice[0]
    staff_id=class_choice[1]
    normal_score=random.randint(58,100)
    test_score=random.randint(58,100)
    total_score=(normal_score+test_score)//2
    key=f"{student_id}{course_id}"
    key2=f"{student_id}{class_choice[2]}"
    if not (key in dit.keys()or key2 in dit.keys()):
        dit[key]=(total_score)
        dit[key2]=(staff_id)
        content+=f"({student_id},'2023春季','0{course_id}',{staff_id},{normal_score},{test_score},{total_score}),\n"
    else:
        i-=1
    i+=1
    
f.write(content)
f.close()

